<?php

namespace JsonLowCode\UI;

use JsonLowCode\Schema;
use JsonLowCode\Traits\Props\HasClosable;
use JsonLowCode\Traits\Props\HasDisabled;
use JsonLowCode\Traits\Props\HasName;
use JsonLowCode\Traits\Props\HasSize;

/**
 * Form 表单组件
 * @method static Form make(mixed $children = null) Form组件
 */
class Form extends Schema
{
    protected string $componentName = "NForm";

    use HasClosable, HasDisabled, HasName, HasSize;

    /**
     * @param mixed|null $children
     */
    public function __construct(mixed $children = null)
    {
        parent::__construct();
        $this->children($children);
    }

    /**
     * 设置标签对齐方式
     * @param string $align
     * @return $this
     */
    public function labelAlign(string $align = 'left' | 'right'): static
    {
        return $this->prop("label-align",$align);
    }

    /**
     * 设置标签对齐方式
     * @param string $align
     * @return $this
     */
    public function labelPlacement(string $align = 'top' | 'left'): static
    {
        return $this->prop("label-placement",$align);
    }

}
